import 'package:flutter/material.dart';
import 'package:hkzf_flutter/widgets/information/data.dart';
import 'package:hkzf_flutter/widgets/common_image.dart';

const textStyle = TextStyle(color: Colors.black54);

// 资讯项视图结构
class InformationItemWidget extends StatelessWidget {
  final InformationItem data;
  const InformationItemWidget({super.key, required this.data});

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 100.0,
      padding: const EdgeInsets.only(left: 10.0, right: 10.0,bottom: 10.0),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          CommonImage(src: data.imageUri,width: 120.0,height: 90.0,),
          const Padding(padding: EdgeInsets.all(10.0)),
          Expanded(// Expanded是一个用 在Row、Column 或 Flex 布局中填充剩余空间的 widget
            child: Column(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text(data.title,style: const TextStyle(color: Colors.black,fontWeight: FontWeight.bold),),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(data.source,style: textStyle,),
                    Text(data.time,style: textStyle,),
                  ],
                )
              ],
            )
          ),
        ],
      ),
    );
  }
}